Skip to content

fix(telemetry-ingest): add migration runner for sensor_error_log table#59

Merged
LostPointer merged 2 commits intoDafeCpp:developfrom
LostPointer:fix/sensor-error-log-migration
Apr 22, 2026
Merged

fix(telemetry-ingest): add migration runner for sensor_error_log table#59
LostPointer merged 2 commits intoDafeCpp:developfrom
LostPointer:fix/sensor-error-log-migration

Conversation

@LostPointer
Copy link
Copy Markdown
Contributor

Summary

  • GET /api/v1/sensors/:id/error-log возвращал 500 с UndefinedTableError: relation "sensor_error_log" does not exist
  • Таблица sensor_error_log создалась в БД telemetry_ingest_service, а не в experiment_db, к которой подключается сервис
  • Миграция 005_sensor_error_log.sql существовала, но у telemetry-ingest-service не было ни migration runner'а, ни COPY в Dockerfile

Изменения:

  • Добавлен bin/migrate.py (тот же паттерн, что у experiment-service)
  • В Dockerfile добавлены COPY bin/ и COPY migrations/
  • Добавлен Makefile-таргет telemetry-ingest-migrate (применяет миграции в experiment_db)
  • mvp-demo-check теперь зависит от telemetry-ingest-migrate

Hotfix в текущем окружении: миграция применена вручную через psql, checksum зарегистрирован в schema_migrations.

Test plan

  • make dev-clean && make dev-up && make auth-init && make experiment-migrate && make telemetry-ingest-migrate — всё проходит без ошибок
  • GET /api/v1/sensors/:id/error-log возвращает 200 (с валидным JWT) вместо 500
  • Повторный запуск make telemetry-ingest-migrate печатает "No pending migrations." без ошибок

🤖 Generated with Claude Code

LostPointer and others added 2 commits April 21, 2026 21:15
…ensor_error_log table

The sensor_error_log table was missing from experiment_db, causing
UndefinedTableError and 500s on GET /api/v1/sensors/:id/error-log.
Migration 005 existed but had no runner or Dockerfile COPY for the
telemetry-ingest-service container.

- Add bin/migrate.py (same runner pattern as experiment-service)
- Copy bin/ and migrations/ in Dockerfile
- Add telemetry-ingest-migrate Makefile target (targets experiment_db)
- Wire telemetry-ingest-migrate into mvp-demo-check

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All three bin/migrate.py files were identical copies. Extracted
run_migrate_cli() into backend_common/db/migrations.py; each
service's bin/migrate.py is now a 5-line wrapper.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@LostPointer LostPointer merged commit 23e1ce5 into DafeCpp:develop Apr 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant